using System.Text;

namespace Pronghorn.Core
{
	public class MetaNodeVisitor : INodeVisitor
	{
		#region Private Methods

		private static bool isMeta(string line)
		{
			return line.Contains("<!--#{metatags}-->");
		}

		private static string parse(string line)
		{
			if (!isMeta(line)) return line;
			var sb = new StringBuilder();
			sb.AppendLine("RenderCollection((IList<IRenderable>)Model.MetaTags, writer);");
			return sb.ToString();
		}

		#endregion Private Methods

		#region Public Methods

		public void Visit(ISkinNodeParser skinNodeParser)
		{
			skinNodeParser.Line = parse(skinNodeParser.Line);
		}

		#endregion Public Methods
	}
}